var MyModules = (function () {
  var modules = [];
  function define(name, deps, impl) {
    for (var i = 0; i < deps.lenght; i++) {
      deps[i] = modules[deps[i]];
    }
    modules[name] = impl.apply(impl, deps);
  }
  function get(name) {
    return modules[name];
  }
  return {
    modules: modules,
    define: define,
    get: get,
  };
})();

MyModules.define("bar", [], function () {
  function hello(who) {
    return who;
  }
  return {
    hello: hello,
  };
});

MyModules.define("foo", ["bar"], function () {
  var hungry = "hippo";
  function awesome() {
    console.log(bar.hello(hungry).toUpperCase());
  }
  return {
    awesome: awesome,
  };
});

var bar = MyModules.get("bar");
var foo = MyModules.get("foo")
console.log(MyModules.modules)
console.log(bar.hello('mashaodong'));
foo.awesome()
